/**
 * Created by yangfan on 2016/12/26.
 */

/**
 * Created by yangfan on 2016/12/26.
 */
define(['config/appregister',
    "business/services/httpServices",
    "business/library/services/httpServices",
    "business/services/filter"],function(app,httpService,libHttpServices){
    app.directive("detailNav",function($state){
        return {
            templateUrl:"app/business/services/comComponents/detailNavation.html",
            link:function(scope,element,attrs){
             //��ȡ���� ���ʹ������� ��������  �������Ͽ��������
                function getEngSec(tcId){
                    var req = {
                        type: "GET",
                        tcId: tcId,
                        param: 'getSecondaryCategory'
                    };
                    httpService.getSecondCategory(req).success(function (response) {
                        scope.$apply(function(){
                            if(tcId == 1){
                                scope.nation = response.data;
                            }
                            if(tcId == 2){
                                scope.inter = response.data;
                            }
                        })
                    })
                };

                function getLibSec(){
                    var req = {
                        type:"GET",
                        uri:"getSecondaryCategory",
                        data:{
                            tcId:3
                        }
                    };
                    libHttpServices.getSecondaryCategory(req).success(function(response){
                        scope.$apply(function(){
                            scope.lib = response.data;
                        });
                    }).error(function(

                    ){})

                }

                //getEngSec(1);
                //getEngSec(2);
                //getLibSec();
                scope.goTo = function(item){
                    if(item.tcId == 1){
                        state.goTo("eng.main")
                    }
                    if(item.tcId == 2){}
                    if(item.tcId == 3){}
                }
                scope.stateGo = function(state){
                    $state.go(state);
                }



            }
        }
    })
});

